home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / shadobox.arc / WDEMO.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-11-19  |  6.6 KB  |  217 lines

  1. /* "WDEMO.C      ver 0.0a         11/23/87"
  2.    Copyright (c) 1987 John G. Donohue
  3. */
  4.  
  5. #include <defines.h>
  6. #include <wdef.h>
  7.  
  8. int                    x,y,k;
  9. extern ERRCODE         werrnum;
  10. extern struct _window  windows[MAXWIN], *cw;
  11.  
  12. #ifdef DEBUG
  13. extern WNUM            cwnum;
  14. extern WATTR           scn_attr;
  15. #endif
  16.  
  17. /*
  18. extern WNUM            wstack[MAXWIN];
  19. extern int             wstkhgt;
  20. extern COORD           scn_row, scn_column;
  21. extern SCN             screens[2];
  22. extern struct REGS     reg;
  23. */
  24.  
  25. /*****************************************************************************/
  26. int main()
  27. {
  28.         WNUM    w1, w2, w3, w4, w5 /*, w6 */;
  29.         int     i;
  30. #ifdef DEBUG
  31.         WNUM    w;
  32. #endif
  33.  
  34.         w_init();               /* always call this function first */
  35.  
  36.         /* define 4 windows */
  37.         w1 = w_def( -1, WNORMAL_,      10, 47, FG_GREEN|BG_BLUE   ,
  38.                     (BITS) 0,    FG_BROWN|BG_BLUE );
  39.         w2 = w_def( -1, WNORMAL_,       8, 38, FG_BLUE |BG_CYAN,
  40.                     (BITS) 0xa5|BORD_SHADOW, FG_RED|BG_CYAN );
  41.         w3 = w_def( -1, WNORMAL_,      10, 37, FG_GREEN|BG_RED  ,
  42.                     (BITS) 0x5a, FG_CYAN|BG_RED );
  43.         w4 = w_def( -1, CLEAR_ON_OPEN,  6, 35, FG_MAGENTA|BG_WHITE,
  44.                     (BITS) 0xc0, FG_BLACK|BG_WHITE );
  45.         w5 = w_def( -1, CLEAR_ON_OPEN, STDHGT, STDWID, FG_BLUE|BG_BROWN,
  46.                     (BITS) 0xc0|BORD_EDGE, BRIGHT|FG_BROWN|BG_RED );
  47. /*
  48.         w6 = w_def( -1, CLEAR_ON_OPEN, STDHGT, 10, FG_WHITE|BG_BLUE,
  49.                     (BITS) 0xaa, BRIGHT|FG_WHITE|BG_BLUE );
  50. */
  51.         w_open(w1, 3, 30);
  52.         w_puts("\n You are about to see a DAZZLING demonstration\n");
  53.         w_puts("          of windowing software from\n\n");
  54.  
  55.         for (i = 1000; i--; )
  56.                 ;
  57.  
  58.         w_open(w2, 6, 21);
  59.         w_setattr(FGC_, FG_WHITE);
  60.         bright();
  61.         w_puts("\n   Donohue&Co.  Computer Services\n");
  62.         nobright();
  63.         w_setattr(ENTIRE_, cw->wdftattr);
  64.         w_puts("              Box 255\n");
  65.         w_puts("      Hannibal, New York 13074\n");
  66.         w_puts("           (315) 564-6213\n");
  67.         w_cursor(POSITION, 8);
  68.         w_setattr(FGC_, FG_RED);
  69.           w_puts(" Press any key to continue");
  70.         w_setattr(ENTIRE_, cw->wdftattr);
  71.         getv();
  72.         w_cursor(POSITION, 8);
  73.         w_puts("                           ");
  74.  
  75.         w_open(w3, 12, 3);
  76.         w_puts("If you're a C programmer that\n");
  77.         w_puts("needs better control than you've\n");
  78.         w_puts("been getting from other packages,\n");
  79.         w_puts("               AND...\n\n");
  80.         w_puts(" Press any key to continue\n");
  81.         getv();
  82.  
  83.         w_setattr(FGC_, FG_WHITE);
  84.         w_puts("\n\n\n\nC SOURCE CODE FOR WINDOWS\n");
  85.         w_setattr(ENTIRE_, cw->wdftattr);
  86.         w_puts("which is\n");
  87.         w_setattr(FGC_, FG_WHITE);
  88.         w_puts("PORTABLE TO OTHER ENVIRONMENTS,\n");
  89.         blink();
  90.         w_puts("      INCLUDING TERMINALS!!!,\n");
  91.         noblink();
  92.         w_setattr(ENTIRE_, cw->wdftattr);
  93.         w_puts("then you're about to be amazed.\n");
  94.  
  95.         w_puts("Here's why...\n");
  96.         w_puts("         Press any key to continue");
  97.         getv();
  98.  
  99.         w_puts("\n\n\n\nFirst of all, you can ");
  100.  
  101.         w_setattr(FGC_, FG_WHITE);
  102.         w_puts("SCROLL ");
  103.         w_setattr(ENTIRE_, cw->wdftattr);
  104.         w_puts("the\n");
  105.         w_puts("window.  But you figured that out\n");
  106.         w_puts("already.\n\n\n");
  107.  
  108.         w_puts(" Press any key to continue");
  109.         getv();
  110.  
  111.         w_puts("\n\n\n\nYou can use 3 kinds of borders,\n");
  112.         w_puts("or NO BORDERS, and control each\n");
  113.         w_puts("side of your window SEPARATELY!\n");
  114.  
  115.         w_puts("Don't want sides or a bottom, just\n");
  116.         w_puts("a block top border with a title?\n\n");
  117.  
  118.         w_puts(" Press any key to continue\n");
  119.         getv();
  120.  
  121.         w_open(w4, 16, 41);
  122.         w_cursor(-1,6);
  123.         w_setattr(ENTIRE_, cw->wbordattr);
  124.         w_puts("The Window as specified\n");
  125.  
  126.         w_setattr(ENTIRE_, cw->wdftattr);
  127.         w_cursor(0, 0);
  128.         w_puts("\nThen that's what you get!\n");
  129.         w_cursor(cw->wpane.rhgt-1, 25);
  130.         w_setattr(ENTIRE_, cw->wbordattr);
  131.         w_puts("Hit a key: ");
  132.         w_setattr(ENTIRE_, cw->wdftattr);
  133.         getv();
  134.  
  135.         w_current(w3);
  136.         w_puts("\n\n\n\nYou can come back to where you\n");
  137.         w_puts("left off, even while a later\n");
  138.         w_puts("window is still on the screen,\n");
  139.         w_puts("if you don't overlap.\n");
  140.         for (i = 1000; i--; )
  141.                 ;
  142.         w_puts(" Press any key to continue ");
  143.         getv();
  144.  
  145.         w_open(w5, 0, 0);
  146.         w_cursor(10, 25);
  147.         w_puts("Is this not a thing of beauty?\n");
  148.         w_setattr(ENTIRE_, cw->wbordattr);
  149.         blink();
  150.         w_cursor(-1, 51);
  151.         w_puts(" Press any key to continue ");
  152.         noblink();
  153.         getv();
  154.         w_close(w5);
  155.  
  156.         w_current(w3);
  157.         w_puts("\nYou can open the windows in any\n");
  158.         w_puts("order, at different locations on\n");
  159.         w_puts("the screen, and close them without\n");
  160.         w_puts("losing a character!  It's as easy\n");
  161.         w_puts("as shuffling a deck of cards.\n");
  162.         w_puts("Just watch this!\n\n");
  163.         blink();
  164.         w_puts("     Press any key and WATCH!");
  165.         noblink();
  166.         getv();
  167.  
  168.         w_close(w4);
  169.         w_close(w3);
  170.         w_close(w2);
  171.         w_open(w4, 0, 0);
  172.         w_open(w2, 14, 40);
  173.         w_close(w2);
  174.         w_close(w4);
  175.         w_close(w1);
  176.         w_open(w2, 14, 1);
  177.         w_open(w4, 14, 35);
  178.         w_open(w3, 0, 40);
  179.         w_close(w3);
  180.         w_close(w4);
  181.         w_open(w1, 10, 10);
  182.         w_close(w1);
  183.         w_close(w2);
  184.         w_open(w2, 4, 41);
  185.         w_open(w3, 1, 1);
  186.     w_puts("\n\n");
  187.  
  188.         for (i = 30000; i--; )
  189.                 ;
  190.         for (k = 0; k < 8; ++k)
  191.         {
  192.                 w_cursor(POSITION, k);
  193.                 w_setattr(FGC_, k);
  194.                 w_puts("Were you watching?\n");
  195.                 for (i = 30000; i--; )
  196.                 {
  197.                         ++i;
  198.                         --i;
  199.                 }
  200.         }
  201.         for (i = 30000; i--; )
  202.                 ;
  203.         w_close(w3);
  204.  
  205.         for (i = 30000; i--; )
  206.         {
  207.                 ++i;
  208.                 --i;
  209.         }
  210.         w_cursor(POSITION, 0);
  211.         w_setattr(FGC_, FG_RED);
  212.         w_puts("   PORTABLE SOURCE CODE IN C: $45  ");
  213.  
  214.         w_cursor(21,0);
  215.         w_cursor(POSITION, POSITION);   /* force physical cursor there. */
  216. }
  217.